#include<stdio.h>
#include<string.h>
char a[100], ch1, ch2;
int main()
{
	while(scanf("%s %c %c", a, &ch1, &ch2) != EOF)
	{
		int n = strlen(a);
		for(int i=0; i<n; i++)
			if(a[i] == ch1)
				a[i] = ch2;
		printf("%s\n", a);
	}
	return 0;
}
